import Vue from 'vue';
import Router from 'vue-router';
import store from '../store'

Vue.use(Router);

/* 公用布局 */
import Layout from '../views/layout/index';

export const constantRouterMap = [
  {
      path: '/login',
      name: 'Login',
      component: ()=>import('../views/login/index')
    // }, {
    //   path: '/',
    //   name: 'HelloWorld',
    //   component: ()=>import('../components/HelloWorld')
    }, {
    path: '',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    children: [
      {
        path: 'dashboard',
        component: () => import('../views/dashboard/index'),
        name: 'DashboardIndex',
        meta: { title: '首页', icon: 'dashboard', noCache: true }
      }
    ]
  }, {
    path: '/checkoffer',
    component: Layout,
    redirect: '/checkoffer/index',
    name: 'Checkoffer',
    meta: { title: '违法查询', icon: 'check-offer'},
    // alwaysShow: true, // will always show the root menu
    children: [
      {
        path: 'index',
        component: () => import('../views/sspquery/index'),
        name: 'CheckOfferIndex',
        meta: { title: '违法查询'}
      }, {
        path: 'check',
        component: () => import('../views/sspquery/sspsh'),
        name: 'CheckOfferCheck',
        meta: { title: '违法审核'}
      }
    ]
  }
  ];
export const asyncRouterMap = []

store.state.permission.routers = constantRouterMap;
export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
